<template>
  <div>
    <list ref="list">
      <template #toolbar-left>

      </template>
    </list>
  </div>
</template>

<script>
import list from "@/components/fcm/shipment/list";
import api from "@/api/fcm/shipment";
export default {
  components: {
    list
  },
  data() {
    return {
      syncEsLoading: false,
      syncIcpLoading: false,
      resetLoading: false,
      decodeLoading: false
    };
  },
  mounted() {
    this.reload();
  },
  methods: {
    reload() {
      this.$refs.list.$refs.list.reload();
    },
    syncCustomersToEs() {
      var rows = this.$refs.list.getCheckedRows();
      let message = "确定要将选中的客户同步到ES吗？";
      let postData;
      if (rows && rows.length > 0) {
        postData = { ids: rows.map((item) => item.id) };
      } else {
        message = "确定要将客户列表查询结果同步到ES吗？"
        postData = this.$refs.list.$refs.list.tempQueryParams;
      }
      this.$confirm(message, "提示", {
        type: "warning",
      })
        .then(() => {
          this.syncEsLoading = true;
          console.log(postData);
          api.syncCustomersToEs(postData).then((res) => {
            this.syncEsLoading = false;
          });
        })
        .catch(() => { });
    }
  },
};
</script>